<?php

/**
 * 话题编辑
 */


include_once($_SERVER["DOCUMENT_ROOT"] . "/core/inc.php");
include_once($_SERVER["DOCUMENT_ROOT"] . "/core/admin.inc.php");

include_once($_SERVER["DOCUMENT_ROOT"] . "/include/user/inc.php");
include_once($_SERVER["DOCUMENT_ROOT"] . "/include/mblog/inc.php");


$g_cgival = array();
$g_pro = array();
$g_show = array();


function check_cgi_pro()
{
	global $g_cgival, $g_pro, $g_show;
	
	//关键词
	cgi::get($g_cgival["id"], "id", 0);
	$g_cgival["id"] = intval($g_cgival["id"]);
	
	/*//餐厅总店ID
	cgi::both($g_cgival["topic"], "topic", 0);
	$g_cgival["topic"] = string::un_html($g_cgival["topic"]);
	
	cgi::both($g_cgival["status"], "status", "");
	$g_cgival["status"] = string::un_html($g_cgival["status"]);*/
	
}

function get_data()
{
	global $g_cgival, $g_pro, $g_show,$config;
	
	$g_show["id"] = $g_cgival["id"] ;
	
	
	$db_mblog_meinv_topic = new db_mblog_meinv_topic();
	
	$content = $db_mblog_meinv_topic->admin_get_mblog_meinv_topic_item_by_id($g_cgival["id"]);
	if($content["black_word"])
	{
		$content["black_word"] = join("\n",unserialize($content["black_word"]));
	}
	
	$g_show["data"] = $content;
	$g_show["topic_show_type"] = $config["topic_show_type"];
	
}

$g_show["error"] = 0;
$g_show["errmsg"] = '';
try
{
	admin_check_login();
// 	admin_check_user_priv("foodv2/album_list.php");
	
	check_cgi_pro();
	get_data();
}
catch(Exception $e)
{
	$g_show["error"] = 1;
	$g_show["errmsg"] = $e->getMessage();
}

show_pro();
exit;


function show_pro()
{
	global $g_cgival, $g_pro, $g_show;
	if(isset($_GET['debug']))
		print_r($g_show);
	$smarty = p_get_smarty ();
	$smarty->assign ( 'g_show', $g_show );
	$smarty->display ( "mblog/mblog_meinv_topic_edit.html" );
}

